package team.zero.lemon.module.workflow.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import team.zero.lemon.common.authz.annotation.AuthPassport;
import team.zero.lemon.common.persistence.Page;
import team.zero.lemon.common.web.BaseController;
import team.zero.lemon.module.workflow.entity.Package;
import team.zero.lemon.module.workflow.service.PackageService;

import java.util.List;

/**
 * Created by bolin on 2016/10/20.
 */
@Controller
@ResponseBody
@AuthPassport
@RequestMapping(value = "/workflow/package", method = {RequestMethod.POST, RequestMethod.GET})
public class PackageController extends BaseController {
    @Autowired
    private PackageService packageService;
    @AuthPassport
    @RequestMapping("/save")
    public int savePackage(@RequestBody Package aPackage) {
        int result = packageService.save(aPackage);
        return result;
    }
    @AuthPassport
    @RequestMapping("/query/all")
    public List<Package> findAllPackage(@RequestBody Package aPackage) {
        List<Package> result = packageService.findAll();
        return result;
    }
    @AuthPassport
    @RequestMapping("/query/page")
    public Page<Package> findPackage(@RequestBody Package aPackage) {
        return packageService.findPage(aPackage);
    }
    @AuthPassport
    @RequestMapping("/delete/ids")
    public int deletePackage(@RequestBody Package aPackage) {
        return packageService.deleteLogicMulti(aPackage);
    }
}
